<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../resources/main.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml">


    <ui:define name="content">
        <h:outputStylesheet library="css" name="estilo.css" />
        <h:outputScript library="js" name="javaScript.js" />
        <p:separator />
        <div class="pagina">
            Painel de leitos
        </div>
        <p:separator />
        <h:form>

            <p:commandLink value="Hospedar"  action="/restrict/checkinHopedagem.faces" />

            <p:dataGrid  value="#{mbHospedagem.hospedagens}" var="h" columns="4" rows="12" paginator="true" emptyMessage="Não á hospedagem"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                         rowsPerPageTemplate="8,12,16">  <!--"9,12,15"-->

                <p:panel header="#{h.leito.descricao}" style="font-size: 10px; width: 190px; text-align: center;">
                    <h:panelGrid columns="2" style="font-size: 10px; font-weight: bold; background-color: #DEDEDE">                        
                        <h:outputLabel value="Peciente.:" />
                        <h:outputText value="#{h.hospede.nome}" style="color: #00F; font-weight: bold; font-size: 9px;"/>
                        <h:outputLabel value="Cidade.:" />
                        <h:outputText value="#{h.cidade.cidade}" style="color: #00F; font-weight: bold; font-size: 9px;" />
                        <h:outputLabel value="Entrada.:" />
                        <h:outputText value="#{h.dataEntrada}" style="color: #00F; font-weight: bold; font-size: 9px;">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>
                        <h:outputLabel value="Hora.:" />
                        <h:outputText value="#{h.horaEntrada}" style="color: #00F; font-weight: bold; font-size: 9px;" />
                        <h:outputLabel value="Diaria.:" />
                        <h:outputText value="#{h.dataEntrada}" style="color: #00F; font-weight: bold; font-size: 9px;" >
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                            <f:converter converterId="numeroDiaria" />
                        </h:outputText>
                        <h:commandButton value="Finalizar" action="#{mbHospedagem.checkOutHospedagem(h)}" style="color: #F00; font-weight: bold" onclick="return confirmaCheckOut('#{h.hospede.nome}');" />
                    </h:panelGrid>
                </p:panel>
                <f:facet name="footer">
                    <h:outputText value="| Total de Leito = #{mbHospedagem.totalLeitos}  |" style="color: magenta" />
                    <h:outputText value="|Leitos Ocupado = #{mbHospedagem.leitosOcupados}  |" style="color: blue" />
                    <h:outputText value="|Leitos Livres = #{mbHospedagem.leitoLivres} |" style="color: red"/>
                    <h:outputText value="|Taxa de Ocupação = #{mbHospedagem.taxaOcupacao}% |" style="color: green" />
                </f:facet> 
            </p:dataGrid>
        </h:form>
    </ui:define>   

</ui:composition>
